<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>使用background-attachment实现滚动视差</title>
    <style>
      * {
        margin: 0;
        box-sizing: border-box;
        padding: 0;
      }
      section {
        box-sizing: border-box;
        height: 100vh;

        font-size: 20vh;
        line-height: 100vh;
        text-align: center;

        color: #fff;
        background: rgba(0, 0, 0, 0.7);
        background-attachment: fixed;
        background-position: center center;
        background-size: cover;
      }
      .bg-attachment1 {
        background-image: url("./NATOURS/img/nat-3.jpg");
      }
      .bg-attachment2 {
        background-image: url("./NATOURS/img/nat-4.jpg");
      }
      .bg-attachment3 {
        background-image: url("./NATOURS/img/nat-5.jpg");
      }
    </style>
  </head>
  <body>
    <section class="bg-attachment1">IMG1</section>
    <section class="bg-attachment2">IMG2</section>
    <section class="bg-attachment3">IMG3</section>
  </body>
</html>
